import Mock from 'mockjs'


const data = Mock.mock({
	'list|1000': [{
		'url': '@image(100x100, @color)',
		'id|+1': 1,
		'title': '@ctitle',
		'desc': '@cword(20,40)'
	}]
})


Mock.mock('/api/list', 'post', (req) => {
	const { pageSize, pageCode } = JSON.parse(req.body)
	// 分页器截取公式
	const result = data.list.slice((pageCode - 1) * pageSize, pageCode * pageSize) 

	return {
		code: 200,
		data: result
	}
})